<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>中国福利彩票</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">

<!--页面样式-->
<link rel="stylesheet" type="text/css" href="css/style.css" />

</head>
<body  style="width:10rem !important; margin:0 auto">
<script>
/*取设备宽度*/
	function rem(){
	var iWidth=document.documentElement.getBoundingClientRect().width;
	iWidth=iWidth>640?640:iWidth;
	document.getElementsByTagName("html")[0].style.fontSize=iWidth/10+"px";
	};
	rem();
	window.onorientationchange=window.onresize=rem      
</script>
<script src="js/jquery-1.7.2.min.js"></script>
<div class="Header">
<!--     	<div class="left H_logot"><a href="MemberCenter.html"><img src="images/logo.png"></a></div> -->
        <div class="left H_content text-center font28 cfffff">设置新密码</div>
       <div class="right H_right text-right font24"><a href="Login.html"><img src="images/Nimg4.png"></a></div>
        <div class="clear"></div>
    </div>
    
    <div class="Forgetpwd">
    
    	<div class="FPWD_li">
    			
    			
    			
    			<dd class="font28" style="height:1.25rem;line-height:1.25rem;background:#fff;border-radius: 0.15625rem;padding-left:0.3rem;color:#aaa">手机号：<span id='phoneNumShow'></span><span id='phoneNum' style="display: none;"></span></dd>
    			<div class="clear"></div>
    			
    			<input style="float:left;" type="text" class="DT_text2 font28 c666666 Weiruan marginT20" placeholder="验证码" id="smsCode" >
    			<input style="float:right" type="button" id="smsCodeBtn" value="获取验证码" class="FPWD_yan font28 cfffff Weiruan marginT20" onclick="getVerificationCode()"  maxlength="8">
    			<div class="clear"></div>
    	
    	
    	
    		<dl>
    			<dt><img src="images/Fimg2.png"></dt>
    			<dd><input type="password" class="DT_text1 font28 c666666 Weiruan" placeholder="新密码" id="newPwd"></dd>
    			<div class="clear"></div>
    		</dl>
            <dl>
    			<dt><img src="images/Fimg2.png"></dt>
    			<dd><input type="password" class="DT_text1 font28 c666666 Weiruan" placeholder="确认密码" id="rePwd"></dd>
    			<div class="clear"></div>
    		</dl>
    	</div>
        
        <div class="FPWD_1">
        	<input type="submit" value="完 成" class="FPWD_but font32 cfffff Weiruan marginT80"  onclick="nextStep()" />
        </div>
    </div>

	<!-- 弹出alert -->
	<div class="falert" style="display: none;" id="warnInfoDiv">

		<div class="falert_t font30">
			<span style="margin-left: 0.15rem">提示</span>
		</div>
		<div class="falert_b">
			<span id="warnInfo"></span><img class="dianji_gb"
				style="position: absolute; right: 0.1rem; top: 0.15rem; cursor: pointer;"
				width="45rem" src="images/Fimg8.png"
				onclick="closeWarnInfoDiv('warnInfoDiv')" />
		</div>
	</div>
	<!-- 弹出alert -->
</body>
<script src="js/SHA256.js"></script>
<script src="js/jsCallCookies.js"></script>
<script src="js/validation.js"></script>
<script src="js/common.js"></script>
<script src="js/countDown.js"></script>
<script type="text/javascript">
var channelId="";
var accountId=GetQueryString("accountId");
var mobile = GetQueryString("phoneNum");
    /*弹框JS内容*/
    jQuery(document).ready(function($){
    	channelId = getCookie("channelId");
    	$('#phoneNum').html(mobile);
    	$('#phoneNumShow').html(mobile.substring(0,3)+"*****"+mobile.substring(8,11));
    	getVerificationCode();
    });
   
 //获得“短信验证码”
 function getVerificationCode() {
	   //验证手机号格式
 	if(!validatePhoneNum('phoneNum')){
 		return;
 	}
	  var para = {
			  mobile:$('#phoneNum').val(),
			  type:0
	        };
	$.ajax({
		url : "../../api/accountSystem/verification/msgcode",
		async:false,
		type : "POST",
		herder:{
			'Accept':'application/json',
			'Content-Type':'application/json'
		},
		dataType:"json",
		contentType:"application/json",
		data:JSON.stringify(para),
		error:function(XMLHttpRequest, textStatus, errorThrown){
			alert(errorThrown);
		},
		success: function(data, textStatus){
			if(data.success==true){
				messageCodeTime('smsCodeBtn');
			}else{
				alert(data.description);
			}
			
		}		
	});
} 
    
      //点击“完成”执行  
function nextStep() {
	 //验证非空格式
	if(!validateNull('smsCode','短信验证码')){
		return;
	}
	 //忘记密码校验
	if(!validateRecoverLoginPwd('newPwd','rePwd')){
		return;
	}
  var para = {
		  accountId:accountId,
		  mobile:mobile,
		  newPassword:sha256_digest($('#newPwd').val()),
		  smsCode:$('#smsCode').val(),
		  channelId:channelId
        };
	
	$.ajax({
		url : "../../api/accountSystem/account/pwdRecover",
		async:false,
		type : "POST",
		herder:{
			'Accept':'application/json',
			'Content-Type':'application/json'
		},
		dataType:"json",
		contentType:"application/json",
		data: JSON.stringify(para),
		error:function(XMLHttpRequest, textStatus, errorThrown){
			alert(errorThrown);
		},
		success: function(data, textStatus){
			if(data.success == true){
				window.location.href='ForgetpwdWin.html';
			}else{
				window.location.assign(encodeURI('ForgetpwdDown.html?description='+data.description+''));
				return;
			}
		}		
	});
}   
</script>
</html>
